package com.xuecheng.content.controller;

import com.xuecheng.api.content.CourseAuditControllerApi;
import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.qo.QueryCourseModel;
import com.xuecheng.api.content.model.vo.CourseAuditVO;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.content.entity.CourseBase;
import com.xuecheng.content.service.CourseBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wuyunyun
 * @data 2021/10/11 20:55
 */
@RestController
public class CourseAuditController implements CourseAuditControllerApi {
    @Autowired
    private CourseBaseService courseBaseService;
    @Override
    @PostMapping("/m/course/list")
    public PageVO queryCourseList(PageRequestParams params,@RequestBody QueryCourseModel model) {
        return courseBaseService.queryCourseBaseList(params,model,null);
    }

    @Override
    @PostMapping("/m/courseReview/approve")
    public boolean  approveCourse(@RequestBody CourseAuditVO auditVO) {
        CourseBaseDTO courseAuditDTO = new CourseBaseDTO();
        courseAuditDTO.setCourseBaseId(auditVO.getCourseBaseId());
        courseAuditDTO.setAuditStatus(auditVO.getAuditStatus());
        courseAuditDTO.setAuditMind(auditVO.getAuditMind());
        return courseBaseService.approve(courseAuditDTO);
    }
}
